import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
router.beforeEach((to, from, next) => {
  // 在这里可以进行一些逻辑判断，比如设置页面标题
  document.title = to.meta.title || '默认标题' // 设置页面标题为路由元信息中的 title，如果没有设置则使用默认标题
  next()
})

app.use(createPinia())
app.use(router)
app.use(ElementPlus)

app.mount('#app')
